package com.ruoyi.diagnosis.service;

import com.ruoyi.diagnosis.util.ModBusCommandUtil;
import java.util.concurrent.Future;

/**
 * @Projectname: Lymphometry
 * @Filename: ModBusCommandHandler
 * @Author: FANSEA
 * @Data:2024/7/17 14:26
 */
public interface ModBusCommandService {
     String serialPortKey = "";

    /*default byte[] handleCommand(byte[] command){
        //1.发送指令
//        Future<byte[]> future = ModBusCommandUtil.sendModbusCommand(command);
        byte[] res = new byte[0];
        //2.等待响应
        try {
            res = future.get();
        } catch (Exception e) {
            e.printStackTrace();
        }
        //3.异常处理
        if (res == null) {

        }
        //4.处理响应
        if (command[1] == 0x03) {
            return handleReadResponse(command);
        }else if (command[1] == 0x06){
            return handleWriteResponse(command);
        }
        return command;
    };*/

    byte[] handleReadResponse(byte[] command);

    byte[] handleWriteResponse(byte[] command);

}
